package com.shiguiwu.springmybatis.data.json;

import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @description: json
 * @author: stone
 * @date: Created by 2022/3/14 9:18
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.json
 */
public class JsonTests {

    public static void main(String[] args) {
        testJsonStrRequest();
    }


    public static void testJsonStrRequest() {
        Param p = new Param("小狗", 234.53, BigDecimal.valueOf(99.44), null);
        String s = JSONUtil.toJsonStr(p);
        HttpRequest request = HttpRequest.get("http://127.0.0.1:8089/json/jsonStr?jsonStr=" + s);
        HttpResponse execute = request.execute();
        String body = execute.body();

        System.out.println(body);

    }


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Param {

        private String name;

        private double weight;

        private BigDecimal money;

        public Long age;


    }
}
